package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domin.dto.QuestionFormDTO;
import com.tianji.learning.domin.query.QuestionPageQuery;
import com.tianji.learning.domin.vo.QuestionVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 前端控制器
 * </p>
 *
 * @author 金山
 * @since 2025-10-25
 */
@Api(tags = "用户端相关接口")
@RestController
@RequestMapping("/questions")
@RequiredArgsConstructor
public class InteractionQuestionController {
    private final IInteractionQuestionService questionService;

    /**
     * 1.新增互动问题（day5）
     * @param questionFormDTO
     */
    @PostMapping
    @ApiOperation("新增互动问题")
    public void saveQuestion(@RequestBody QuestionFormDTO questionFormDTO){
        questionService.saveQuestion(questionFormDTO);
    }

    /**
     * 2.分页查询互动问题列表（day5）
     * @param pageQuery
     * @return
     */
    @ApiOperation("分页查询互动问题列表")
    @GetMapping("/page")
    public PageDTO<QuestionVO> pageQuery(QuestionPageQuery pageQuery){
     return questionService.pageQuery(pageQuery);

    }


}
